#include "CCamera.h"
#include "GameSceneManager.h"
#include "GameSystemManager.h"

/*static*/ comp_id_type CCamera::mFamilyID = "CCamera";
/*static*/ comp_id_type CCamera::mComponentID = "CCamera";

/*static*/ comp_id_type CCameraTemplate::mFamilyID = "CCamera";
/*static*/ comp_id_type CCameraTemplate::mComponentID = "CCamera";

Camera* CCamera::mCamera = NULL;
Viewport* CCamera::mViewport = NULL;
RenderWindow* CCamera::mWindow = NULL;

GameComponent *CCameraTemplate::makeComponent() {
	CCamera *comp = new CCamera(this);
	comp->reset();
	return comp;
}

//class CCamera;
CCamera::CCamera() //const
{
	mCamera = GameSceneManager::getSingleton()->getCamera();
	mViewport = GameSceneManager::getSingleton()->getViewport();
	mWindow = GameSystemManager::getSingleton()->getOgre()->getWindow();
}
CCamera::CCamera(CCameraTemplate *templ) //const
{
	mCamera = GameSceneManager::getSingleton()->getCamera();
	mViewport = GameSceneManager::getSingleton()->getViewport();
	mWindow = GameSystemManager::getSingleton()->getOgre()->getWindow();
}
CCamera::~CCamera()
{

}
void CCamera::reset()
{
	//reset camera components
}

void CCamera::setup()
{
	mViewport->setBackgroundColour(ColourValue(0.47f, 0.67f, 0.96f));	//Blue sky background color
	mCamera->setAspectRatio(Real(mViewport->getActualWidth()) / Real(mViewport->getActualHeight())  );
	mCamera->setNearClipDistance(1.0f);
	mCamera->setFarClipDistance(2000.0f);
	
	
	//mCamera->setQueryFlags(100);
}

void CCamera::update() {
	//sky_config.camPos = mCamera->getPosition();
}

void CCamera::moveCamera()
{
	
}

